Field
Aspects of the present invention generally relate to a communication apparatus, a method for controlling a communication apparatus, and a storage medium.
Description of the Related Art
In recent years, in many cases, electronic apparatuses, such as digital cameras and printers, have been equipped with a wireless local area network (LAN) station function and a communication apparatus (a communication function). Such an electronic apparatus equipped with the communication apparatus or the communication function (hereinafter simply referred to as an “electronic apparatus”) can connect to a wireless LAN, and wirelessly communicate with another electronic apparatus. Japanese Patent Application Laid-Open No. 2011-35768 discusses a technique for facilitating image sharing between a digital camera equipped with the wireless LAN function and another electronic apparatus.
A standard called Wireless Fidelity (Wi-Fi) Direct (registered trademark) is established by Wi-Fi Alliance as one of protocols for this wireless LAN. This Wi-Fi Direct (hereinafter referred to as “WFD”) allows the electronic apparatuses equipped with the wireless LAN function to directly connect to each other via the wireless LAN to perform data communication with each other without requiring a communication apparatus such as a router and a Wi-Fi base station to intermediate therebetween. This WFD standard defines a protocol of determining which role each electronic apparatus operates, that is, whether it operates as a wireless LAN access point, or a wireless LAN station. By performing this defined protocol, the electronic apparatuses can automatically determine which apparatus serves as the wireless LAN access point, and which apparatus serves as the wireless LAN station, and establish a wireless LAN connection, so that this technique is highly convenient for a user.
For example, Near Field Communication (hereinafter referred to as “NFC”) (International Organization for Standardization (ISO)/International Electrotechnical Commission (IEC) 18092, ISO/IEC 21481, or the like), which is a close proximity wireless communication technique, can be used based on the WFD standard. This NFC is applied to the electronic apparatuses as a close proximity-type non-contact communication protocol. The electronic apparatuses equipped with the NFC function can exchange data stored in the apparatuses with each other, and automatically perform data communication therebetween when brought into close proximity of each other. This function allows the user to establish the wireless LAN connection based on WFD with a desired electronic apparatus only with an easy operation.
The electronic apparatus in compliance with the NFC standard includes an NFC tag and an NFC reader/writer built therein, and performs the NFC communication with another electronic apparatus with use of these NFC tag and NFC reader/writer. The NFC tag includes, for example, a nonvolatile memory and an antenna, and can permit the NFC reader/writer of another electronic apparatus to read and write various kinds of data stored in the nonvolatile memory via the NFC communication. Further, the NFC reader/writer can read and write the data in the nonvolatile memory in the NFC tag built in another electronic apparatus via the NFC communication.
Japanese Patent Application Laid-Open No. 2009-207069 discusses a technique that exchanges information about a capability between the electronic apparatuses with use of this close proximity wireless communication (the NFC communication).
By utilizing the above-described technique, the electronic apparatus can exchange information about a communication parameter and an application for the wireless communication that the electronic apparatus itself supports, with the electronic apparatus at the other end (an opponent apparatus) with use of the NFC communication. This exchange allows the electronic apparatus to detect an electronic apparatus that can provide a desired service, and reliably and easily establish the wireless LAN connection based on WFD with the detected electronic apparatus.
The electronic apparatuses can exchange via the NFC communication information about a service that uses the communication via the wireless LAN connection, only when an identification name of the service is stored that uses the wireless LAN communication in this NFC tag. For example, in a case where the electronic apparatus has a print function as one example of such a service, this electronic apparatus can become an apparatus (a “service provider apparatus”) that provides a print service when an identification name of the print service is stored in its own NFC tag.
On the other hand, the electronic apparatus at the other end can become an apparatus that uses the print service (a “service using apparatus”), if the user wants to use the print service of the service provider apparatus that provides the print service. In this case, the service using apparatus at the other end acquires the information stored in the NFC tag of the service provider apparatus from the apparatus that provides the print service (the service provider apparatus), with use of the NFC reader/writer. Then, the service using apparatus can determine whether the WFD connection for printing can be performed by checking whether there is the identification name of the print service in the information stored in this NFC tag.
At this time, when the information stored in its own NFC tag is read by the NFC reader/writer of the apparatus at the other end, the electronic apparatus having the print function (the service provider apparatus) can start the WFD connection for the print service, triggered by this reading.
The electronic apparatuses, each of which includes the NFC tag and the NFC reader/writer and can become both the service provider apparatus and the service using apparatus, establish, for example, the wireless LAN connection based on WFD (hereinafter referred to as the “WFD connection”) with use of the above-described technique. This example will be described now.
For example, it is assumed that a digital camera (the electronic apparatus) supports a function of transferring an imaging file to a smartphone (the electronic apparatus) (hereinafter referred to as a “SEND service”), and a function of transmitting streaming data, such as a moving image (hereinafter referred to as a “PLAY service”).
In this case, the digital camera stores information about the SEND service in its own NFC tag as the service provider apparatus of the SEND service. Further, when using the moving image streaming function, the digital camera activates the NFC reader/writer to read the NFC tag of the electronic apparatus at the other end as the apparatus using the PLAY service.
On the other hand, the smartphone stores information about the PLAY service in its own NFC tag as the apparatus providing the PLAY service and activates the NFC reader/writer to read the NFC tag of the electronic apparatus at the other end as the apparatus using the SEND service when the imaging file is received. At this time, if both the digital camera and the smartphone have activated their respective own NFC readers/writers, the WFD connection unintended by a user of one of the electronic apparatuses may be established when the digital camera and the smartphone perform the NFC communication.
This is because the WFD connection is established in a different manner depending on whether the NFC tag of the smartphone is read by the NFC reader/writer of the digital camera, or the NFC tag of the digital camera is read by the NFC reader/writer of the smartphone. The WFD connection is first established for the service stored in any of the NFC tags that is read earlier between them, and it is determined that one of the electronic apparatuses that corresponds to the NFC tag read earlier becomes the service provider apparatus, and the other electronic apparatus becomes the service using apparatus. Therefore, when the user moves the user's own electronic apparatus closer to another electronic apparatus with an intention to start a certain service, the two electronic apparatuses each attempt to read the NFC tag of the electronic apparatus at the other end. Consequently the service desired by the user is not necessarily started.
For example, suppose that the information in the NFC tag of the digital camera is read by the smartphone first as a result of the NFC communication between the digital camera and the smartphone, even though the user of the digital camera intends to receive the PLAY service. As a result, the WFD connection for the SEND service may be established, in which the digital camera becomes the service provider apparatus. In such a case, the digital camera ends up becoming the service provider apparatus although the digital camera should become the service using apparatus.
On the other hand, suppose that the information in the NFC tag of the smartphone is read by the digital camera first as a result of the NFC communication between the smartphone and the digital camera, even though the user of the smartphone intends to receive the SEND service. As a result, the WFD connection for the PLAY service may be established, in which the smartphone becomes the service provider apparatus. In such a case, the smartphone ends up becoming the service provider apparatus although the smartphone should be the service using apparatus.
Thus, the conventional method for connecting the electronic apparatuses to each other may lead to the establishment of the connection for the service unintended by the user of one apparatus when the apparatuses capable of becoming both the service provider apparatus and the service using apparatus establish the WFD connection with use of the NFC communication. As a result, the unintended communication (service) may be started.